package com.linkage.jz.bankruptcy.activity.Project.ZQUser;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.JsonObject;
import com.linkage.jz.bankruptcy.BankruptcyApp;
import com.linkage.jz.bankruptcy.Consts;
import com.linkage.jz.bankruptcy.R;
import com.linkage.jz.bankruptcy.activity.Main.CreateAddrActivity;
import com.linkage.jz.bankruptcy.adapter.FullyGridLayoutManager;
import com.linkage.jz.bankruptcy.base.BaseCreateActivity;
import com.linkage.jz.bankruptcy.bean.ApplyChangerZQUserNameBean;
import com.linkage.jz.bankruptcy.bean.MyAddr;
import com.linkage.jz.bankruptcy.bean.TaskAtta;
import com.linkage.jz.bankruptcy.bean.ZQUserDetailBaseInfo;
import com.linkage.jz.bankruptcy.bean.ZQUserInfo2;
import com.linkage.jz.bankruptcy.event.RefreshEvent;
import com.linkage.jz.bankruptcy.net.BaseSubscriber;
import com.linkage.jz.bankruptcy.net.Network;
import com.linkage.jz.bankruptcy.utils.SPUtils;
import com.linkage.jz.bankruptcy.widget.ApplyBaseReplyDialog;
import com.linkage.jz.bankruptcy.widget.CommonPromptDialog;
import com.linkage.seapeak.pojo.UploadImage;
import com.linkage.seapeak.utils.ToastUtil;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;


/**
 * @author AFAP
 * 债权人信息编辑
 */
public class ApplyChangeZQUserBaseInfoActivity extends BaseCreateActivity implements OnClickListener {
    private static final String TAG = ApplyChangeZQUserBaseInfoActivity.class.getSimpleName();
    private static final String ACTION_EDIT = "ACTION_EDIT";
    private static final String KEY_ZQUSER = "KEY_ZQUSER";
    private static final String KEY_TYPE = "KEY_TYPE";

    private int REQUEST_CODE_ADDRESS = 10001;

    private String mAction = "";
    private static ZQUserInfo2 mZQUserInfo;
    // TODO
    private int opType = 0; //0:发送验证, 1:暂存
    private static int mType = 1; //0管理人，1债权人
    private static int mEdittype = 0; //0审核，1查看

    private static final int TYPE_BIG_JG = 0; //  0:机构债权人,1:自然债权人,2:税务
    private static final int TYPE_BIG_ZRR = 1;
    private static final int TYPE_BIG_SW = 2;
    private static final int TYPE_SMALL_FDDBR = 0; //0:法定代表人, 1:代理人 2:本人
    private static final int TYPE_SMALL_DLR = 1;
    private static final int TYPE_SMALL_BR = 2;
    private static final int TYPE_UPLOAD = 0; // 0:线上,1:线下
    private static final int TYPE_LOCAL = 1;

    private int identityBigTypes = TYPE_BIG_JG; // 身份大类
    private int identitySmallTypes = TYPE_SMALL_FDDBR; // 身份小类
    private int provideBusinessLicense = TYPE_UPLOAD; // 营业执照提供方式
    private int provideLegalRepresentative = TYPE_UPLOAD; // 法定代表人身份证明提供方式

    private int provideCardInt = TYPE_UPLOAD; // 法定代表人身份证明提供方式


    private int provideCard1 = TYPE_UPLOAD; // 法定代表人身份证提供方式
    private int creditorsProvideCard = TYPE_UPLOAD; // 代理人身份证提供方式
    private int provideCard3 = TYPE_UPLOAD; // 本人身份证提供方式
    private String sysAddressId = ""; //邮寄地址
    private int providePowerAttorney = TYPE_UPLOAD; // 授权委托书提供方式
    private MyAddr mAddrInfo;


    // 营业执照
    private RecyclerView mImgRecyclerView_yyzz;
    private List<UploadImage> mImgList_yyzz = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_yyzz;

    // 法人身份证明文件
    private RecyclerView mImgRecyclerView_frsfzm;
    private List<UploadImage> mImgList_frsfzm = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_frsfzm;

    // 法人身份证明文件2
    // 机构-代理人也有一个这个，而且在不同的位置
//    private RecyclerView mImgRecyclerView_frsfzm2;
//    private List<UploadImage> mImgList_frsfzm2 = new ArrayList<>();
//    private GridImagesAdapter mImgAdapter_frsfzm2;

    // 法人身份证、执业证
    private RecyclerView mImgRecyclerView_frsfz;
    private List<UploadImage> mImgList_frsfz = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_frsfz;

    // 代理人身份证
    private RecyclerView mImgRecyclerView_dlr_sfz_zyz;
    private List<UploadImage> mImgList_dlr_sfz_zyz = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_dlr_sfz_zyz;

    // 代理人授权委托
    private RecyclerView mImgRecyclerView_dlr_sqwt;
    private List<UploadImage> mImgList_dlr_sqwt = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_dlr_sqwt;

    // 自然人本人
    private RecyclerView mImgRecyclerView_zrr_br_sfz;
    private List<UploadImage> mImgList_zrr_br_sfz = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_zrr_br_sfz;

    private RecyclerView mImgRecyclerView_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz;
    private List<UploadImage> mImgList_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz;


    //变更证明
    private RecyclerView mImgRecyclerView_zrr_recycler_imgs_chanage;
    private List<UploadImage> mImgList_zrr_recycler_imgs_chanage = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_zrr_recycler_imgs_chanage;

    //其他补充文件
    private RecyclerView mImgRecyclerView_zrr_recycler_imgs_otherfile;
    private List<UploadImage> mImgList_zrr_recycler_imgs_otherfile = new ArrayList<>();
    private GridImagesAdapter mImgAdapter_zrr_recycler_imgs_otherfile;


    private ApplyBaseReplyDialog dialog;


    private EditText et_zqr_name, et_zqr_base_jg_social, et_zqr_base_jg_legalname, et_zqr_fr_mobile,
            et_zqr_fr_mobile_other, et_zqr_fr_email, et_zqr_fr_cardnum, zqr_change,
            et_zqr_fr_bank, et_zqr_fr_bankBranch, et_zqr_fr_bankAccountName, et_zqr_fr_bankAccount,
            et_zqr_dlr_name, et_zqr_dlr_mobile, et_zqr_dlr_mobile_other, et_zqr_dlr_email, et_zqr_dlr_sfz_zyz,
            et_zqr_zrr_br_mobile, et_zqr_zrr_br_mobile_other, et_zqr_zrr_br_email, et_zqr_zrr_br_card, zrr_zqrheadinfo_zrr_zqr_info_et_zqr_zrr_br_card;
    private TextView tv_zqr_address, btn_commit;

    private View area_zqr_type, area_zqr_type_small, include_zqr_base_group,
            include_zqr_legal_person, include_zqr_dlr,
            include_zqr_zrr_br, zrr_zqrheadinfo;

    //    private static String mProID;
//    public static void start(Context context,MyProInfo info) {
//        Intent intent = new Intent(context, CreateProFlowActivity.class);
//        mInfo = info;
//        context.startActivity(intent);
//    }
    CommonPromptDialog mPromptDialog;

    public static void start(Context context, ApplyChangerZQUserNameBean info, int cType, int edittype) {
        Intent intent = new Intent(context, ApplyChangeZQUserBaseInfoActivity.class);
//        intent.putExtra(KEY_ZQUSER, info);
        if(edittype ==0) {
            mZQUserInfo = info.getCreditorInfo();
        }else{
            mZQUserInfo = info.getChange();
        }
        intent.putExtra(KEY_TYPE, cType);
        mEdittype = edittype;
        context.startActivity(intent);
    }

    @Override
    public void setListener() {
    }

    @Override
    public void initTitle() {
    }

    @Override
    public void initView() {
    }

    @Override
    public void initData() {
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_apply_change_zqbase_user);
        super.onCreate(savedInstanceState);
        titlebar_title.setText("债权人信息");

//        ApplyChangerZQUserNameBean info = (ApplyChangerZQUserNameBean) getIntent().getSerializableExtra(KEY_ZQUSER);
//        mZQUserInfo = info.getCreditorInfo();
        mType = getIntent().getIntExtra(KEY_TYPE, 0);
        // 如果有了大类了，就认为是已经有了，进来编辑的
//        if (mZQUserInfo.getIdentityBigTypes() != null) {
//            mAction = ACTION_EDIT;
//            titlebar_title.setText("编辑资料");
//        }


        initViews();
        titlebar_menu_text.setText("发送");
//        if (1 == mType) {
//            titlebar_title.setText("填写基础信息");
//            titlebar_menu_text.setText("发送验证");
//        }
        showTitle();
        titlebar_menu_text.setOnClickListener(this);

//        mPromptDialog = new CommonPromptDialog(this, CommonPromptDialog.TYPE_TIPS);
//        mPromptDialog.setContent("该操作须取得债权人授权或依据文件");
//        mPromptDialog.setPositiveClickListener("已取得", view -> mPromptDialog.dismiss());
//        mPromptDialog.setmCloseListener(v -> {
//            mPromptDialog.dismiss();
//            finish();
//        });
//        mPromptDialog.setNegativeClickListener("暂未取得", view -> {
//            mPromptDialog.dismiss();
//            finish();
//        });
//        if(mType==0) {
//            mPromptDialog.show();
//        }
    }


    //     mType = 1; //0管理人，1债权人
//     mEdittype = 0; //0新增，1修改
    private void showTitle() {

        if (mType == 0) {
            findViewById(R.id.titlebar_menu_text_zancun).setVisibility(View.INVISIBLE);
            findViewById(R.id.zqr_legal_ll_bank).setVisibility(View.VISIBLE);
            findViewById(R.id.zqr_ll_bank).setVisibility(View.VISIBLE);
//            titlebar_menu_text_zancun
        } else {
            findViewById(R.id.titlebar_menu_text_zancun).setVisibility(View.VISIBLE);
            findViewById(R.id.zqr_legal_ll_bank).setVisibility(View.GONE);
            findViewById(R.id.zqr_ll_bank).setVisibility(View.GONE);
        }

//        if (mType == 1 && (mEdittype == 0 || mEdittype == 1)) {
//            titlebar_title.setText("填写基础信息");
//        }
//        if (mType == 0 && mEdittype == 0) {
//            titlebar_title.setText("录入债权人基础信息");
//        }
//        if (mType == 0 && mEdittype == 1) {
//            titlebar_title.setText("录入债权人基础信息");
//        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK && data != null) {
            if (requestCode == REQUEST_CODE_ADDRESS) {
                sysAddressId = data.getStringExtra("id");
                tv_zqr_address.setText(data.getStringExtra("desc"));
                mAddrInfo = (MyAddr) data.getSerializableExtra("bean");
            }
        }
    }

    private void initViews() {
        titlebar_back.setOnClickListener(this);
        titlebar_menu_text.setText("发送");
        titlebar_menu_text.setVisibility(View.VISIBLE);

        et_zqr_name = findViewById(R.id.et_zqr_name);
        area_zqr_type = findViewById(R.id.area_zqr_type);
        area_zqr_type_small = findViewById(R.id.area_zqr_type_small);

        include_zqr_base_group = findViewById(R.id.include_zqr_base_group);
        include_zqr_legal_person = findViewById(R.id.include_zqr_legal_person);
        include_zqr_dlr = findViewById(R.id.include_zqr_dlr);
        include_zqr_zrr_br = findViewById(R.id.include_zqr_zrr_br);

        zrr_zqrheadinfo = findViewById(R.id.zrr_zqrheadinfo);
        et_zqr_base_jg_social = findViewById(R.id.et_zqr_base_jg_social);
        zqr_change = findViewById(R.id.zqr_change);

        zrr_zqrheadinfo_zrr_zqr_info_et_zqr_zrr_br_card = findViewById(R.id.zrr_zqrheadinfo_zrr_zqr_info_et_zqr_zrr_br_card);
        et_zqr_base_jg_legalname = findViewById(R.id.et_zqr_base_jg_legalname);
        et_zqr_fr_mobile = findViewById(R.id.et_zqr_fr_mobile);
        et_zqr_fr_mobile_other = findViewById(R.id.et_zqr_fr_mobile_other);
        et_zqr_fr_email = findViewById(R.id.et_zqr_fr_email);
        et_zqr_fr_cardnum = findViewById(R.id.et_zqr_fr_cardnum);
        et_zqr_fr_bank = findViewById(R.id.et_zqr_fr_bank);
        et_zqr_fr_bankBranch = findViewById(R.id.et_zqr_fr_bankBranch);
        et_zqr_fr_bankAccountName = findViewById(R.id.et_zqr_fr_bankAccountName);
        et_zqr_fr_bankAccount = findViewById(R.id.et_zqr_fr_bankAccount);

        et_zqr_dlr_name = findViewById(R.id.et_zqr_dlr_name);
        et_zqr_dlr_mobile = findViewById(R.id.et_zqr_dlr_mobile);
        et_zqr_dlr_mobile_other = findViewById(R.id.et_zqr_dlr_mobile_other);
        et_zqr_dlr_email = findViewById(R.id.et_zqr_dlr_email);
        et_zqr_dlr_sfz_zyz = findViewById(R.id.et_zqr_dlr_sfz_zyz);

        et_zqr_zrr_br_mobile = findViewById(R.id.et_zqr_zrr_br_mobile);
        et_zqr_zrr_br_mobile_other = findViewById(R.id.et_zqr_zrr_br_mobile_other);
        et_zqr_zrr_br_email = findViewById(R.id.et_zqr_zrr_br_email);
        et_zqr_zrr_br_card = findViewById(R.id.et_zqr_zrr_br_card);
        tv_zqr_address = findViewById(R.id.tv_zqr_address);

        mImgRecyclerView_yyzz = findViewById(R.id.recycler_imgs_yyzz);
        mImgRecyclerView_yyzz.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false));
        mImgAdapter_yyzz = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_yyzz.setList(mImgList_yyzz);
        mImgAdapter_yyzz.setSelectMax(1);
        mImgRecyclerView_yyzz.setAdapter(mImgAdapter_yyzz);

        mImgRecyclerView_frsfzm = findViewById(R.id.recycler_imgs_frsfzm);
        mImgRecyclerView_frsfzm.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_frsfzm = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_frsfzm.setList(mImgList_frsfzm);
        mImgRecyclerView_frsfzm.setAdapter(mImgAdapter_frsfzm);

//        mImgRecyclerView_frsfzm2 = findViewById(R.id.recycler_imgs_frsfzm2);
//        mImgRecyclerView_frsfzm2.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
//                false));
//        mImgAdapter_frsfzm2 = new BaseCreateActivity.GridImagesAdapter(this, TYPE_EDIT);
//        mImgAdapter_frsfzm2.setList(mImgList_frsfzm2);
//        mImgRecyclerView_frsfzm2.setAdapter(mImgAdapter_frsfzm2);

        mImgRecyclerView_frsfz = findViewById(R.id.recycler_imgs_frsfz);
        mImgRecyclerView_frsfz.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false));
        mImgAdapter_frsfz = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_frsfz.setList(mImgList_frsfz);
        mImgRecyclerView_frsfz.setAdapter(mImgAdapter_frsfz);

        mImgRecyclerView_dlr_sfz_zyz = findViewById(R.id.recycler_imgs_dlr_sfz_zyz);
        mImgRecyclerView_dlr_sfz_zyz.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_dlr_sfz_zyz = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_dlr_sfz_zyz.setList(mImgList_dlr_sfz_zyz);
        mImgRecyclerView_dlr_sfz_zyz.setAdapter(mImgAdapter_dlr_sfz_zyz);

        mImgRecyclerView_dlr_sqwt = findViewById(R.id.recycler_imgs_dlr_sqwt);
        mImgRecyclerView_dlr_sqwt.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_dlr_sqwt = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_dlr_sqwt.setList(mImgList_dlr_sqwt);
        mImgRecyclerView_dlr_sqwt.setAdapter(mImgAdapter_dlr_sqwt);

        mImgRecyclerView_zrr_br_sfz = findViewById(R.id.recycler_imgs_zrr_br_sfz);
        mImgRecyclerView_zrr_br_sfz.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_zrr_br_sfz = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_zrr_br_sfz.setList(mImgList_zrr_br_sfz);
        mImgRecyclerView_zrr_br_sfz.setAdapter(mImgAdapter_zrr_br_sfz);


        mImgRecyclerView_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz = findViewById(R.id.zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz);
        mImgRecyclerView_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz.setList(mImgList_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz);
        mImgRecyclerView_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz.setAdapter(mImgAdapter_zrr_zqrheadinfo_recycler_imgs_zrr_br_sfz);


        mImgRecyclerView_zrr_recycler_imgs_chanage = findViewById(R.id.zrr_recycler_imgs_chanage);
        mImgRecyclerView_zrr_recycler_imgs_chanage.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_zrr_recycler_imgs_chanage = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_zrr_recycler_imgs_chanage.setList(mImgList_zrr_recycler_imgs_chanage);
        mImgRecyclerView_zrr_recycler_imgs_chanage.setAdapter(mImgAdapter_zrr_recycler_imgs_chanage);

        mImgRecyclerView_zrr_recycler_imgs_otherfile = findViewById(R.id.zrr_recycler_imgs_otherfile);
        mImgRecyclerView_zrr_recycler_imgs_otherfile.setLayoutManager(new FullyGridLayoutManager(this, 3, GridLayoutManager.VERTICAL,
                false));
        mImgAdapter_zrr_recycler_imgs_otherfile = new GridImagesAdapter(this, TYPE_EDIT);
        mImgAdapter_zrr_recycler_imgs_otherfile.setList(mImgList_zrr_recycler_imgs_otherfile);
        mImgRecyclerView_zrr_recycler_imgs_otherfile.setAdapter(mImgAdapter_zrr_recycler_imgs_otherfile);


        // 大类型
        ((RadioGroup) findViewById(R.id.rg_zqr_sf_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_sf_type_1) {
                identityBigTypes = TYPE_BIG_JG;

                findViewById(R.id.rg_zqr_czr_type_1).setVisibility(View.VISIBLE);
                findViewById(R.id.rg_zqr_czr_type_3).setVisibility(View.GONE);

                ((RadioButton) findViewById(R.id.rg_zqr_czr_type_1)).setChecked(true);
                identitySmallTypes = TYPE_SMALL_FDDBR;

            } else if (which == R.id.rg_zqr_sf_type_2) {
                identityBigTypes = TYPE_BIG_ZRR;
                findViewById(R.id.rg_zqr_czr_type_1).setVisibility(View.GONE);
                findViewById(R.id.rg_zqr_czr_type_3).setVisibility(View.VISIBLE);
                ((RadioButton) findViewById(R.id.rg_zqr_czr_type_3)).setChecked(true);
                identitySmallTypes = TYPE_SMALL_BR;
            } else if (which == R.id.rg_zqr_sf_type_3) {
                identityBigTypes = TYPE_BIG_SW;
            }
            showStatus();
        });

        // 小类型
        ((RadioGroup) findViewById(R.id.rg_zqr_czr_type)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int which) {
                if (which == R.id.rg_zqr_czr_type_1) {
                    identitySmallTypes = TYPE_SMALL_FDDBR;
                } else if (which == R.id.rg_zqr_czr_type_2) {

                    identitySmallTypes = TYPE_SMALL_DLR;
                } else if (which == R.id.rg_zqr_czr_type_3) {
                    identitySmallTypes = TYPE_SMALL_BR;
                }
                showStatus();
            }
        });

        // 营业执照提供方式
        ((RadioGroup) findViewById(R.id.rg_zqr_yyzz_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_yyzz_type_1) {
                provideBusinessLicense = TYPE_UPLOAD;
                findViewById(R.id.area_upload_yyzz).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_yyzz_type_2) {
                provideBusinessLicense = TYPE_LOCAL;
                findViewById(R.id.area_upload_yyzz).setVisibility(View.GONE);
            }
        });

        // 债权人身份证明方式
        ((RadioGroup) findViewById(R.id.zrr_zqrheadinfo_rg_zqr_zrr_br_sfz_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.zrr_zqrheadinfo_rg_zqr_zrr_br_sfz_type_1) {
                provideBusinessLicense = TYPE_UPLOAD;
                findViewById(R.id.zrr_zqrheadinfo_area_upload_zrr_br_sfz).setVisibility(View.VISIBLE);
            } else if (which == R.id.zrr_zqrheadinfo_rg_zqr_zrr_br_sfz_type_2) {
                provideBusinessLicense = TYPE_LOCAL;
                findViewById(R.id.zrr_zqrheadinfo_area_upload_zrr_br_sfz).setVisibility(View.GONE);
            }
        });


        // 法人身份证明
        ((RadioGroup) findViewById(R.id.rg_zqr_frsfzm_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_frsfzm_type_1) {
                provideCardInt = TYPE_UPLOAD;
                findViewById(R.id.area_upload_frsfzm).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_frsfzm_type_2) {
                provideCardInt = TYPE_LOCAL;
                findViewById(R.id.area_upload_frsfzm).setVisibility(View.GONE);
            }
        });

        // 法人身份证
        ((RadioGroup) findViewById(R.id.rg_zqr_frsfz_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_frsfz_type_1) {
                provideCard1 = TYPE_UPLOAD;
                findViewById(R.id.area_upload_frsfz).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_frsfz_type_2) {
                provideCard1 = TYPE_LOCAL;
                findViewById(R.id.area_upload_frsfz).setVisibility(View.GONE);
            }
        });

        // 代理人身份证执业证
        ((RadioGroup) findViewById(R.id.rg_zqr_dlr_sfz_zyz_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_dlr_sfz_zyz_type_1) {
                creditorsProvideCard = TYPE_UPLOAD;
                findViewById(R.id.area_upload_dlr_sfz_zyz).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_dlr_sfz_zyz_type_2) {
                creditorsProvideCard = TYPE_LOCAL;
                findViewById(R.id.area_upload_dlr_sfz_zyz).setVisibility(View.GONE);
            }
        });

        // 代理人授权委托
        ((RadioGroup) findViewById(R.id.rg_zqr_dlr_sqwt_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_dlr_sqwt_type_1) {
                providePowerAttorney = TYPE_UPLOAD;
                findViewById(R.id.area_upload_dlr_sqwt).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_dlr_sqwt_type_2) {
                providePowerAttorney = TYPE_LOCAL;
                findViewById(R.id.area_upload_dlr_sqwt).setVisibility(View.GONE);
            }
        });

        // 本人身份证
        ((RadioGroup) findViewById(R.id.rg_zqr_zrr_br_sfz_type)).setOnCheckedChangeListener((radioGroup, which) -> {
            if (which == R.id.rg_zqr_zrr_br_sfz_type_1) {
                provideCard3 = TYPE_UPLOAD;
                findViewById(R.id.area_upload_zrr_br_sfz).setVisibility(View.VISIBLE);
            } else if (which == R.id.rg_zqr_zrr_br_sfz_type_2) {
                provideCard3 = TYPE_LOCAL;
                findViewById(R.id.area_upload_zrr_br_sfz).setVisibility(View.GONE);
            }
        });
        showStatus();


        if (TextUtils.equals(mAction, ACTION_EDIT)) {
            // 大小类型隐藏
            area_zqr_type.setVisibility(View.GONE);

            if (mZQUserInfo.getIdentityBigTypes() != null) {
                et_zqr_name.setText(mZQUserInfo.getCreditorName());
                et_zqr_fr_mobile.setText(mZQUserInfo.getContact());
                et_zqr_dlr_mobile.setText(mZQUserInfo.getContact());
                et_zqr_zrr_br_mobile.setText(mZQUserInfo.getContact());
                int bigType = mZQUserInfo.getIdentityBigTypes().getValue();
                if (bigType == TYPE_BIG_JG) {
                    findViewById(R.id.rg_zqr_sf_type_1).performClick();
                } else if (bigType == TYPE_BIG_ZRR) {
                    findViewById(R.id.rg_zqr_sf_type_2).performClick();
                } else if (bigType == TYPE_BIG_SW) {
                    findViewById(R.id.rg_zqr_sf_type_3).performClick();
                }

                if (bigType == TYPE_BIG_SW) {
                    findViewById(R.id.rg_zqr_czr_type_2).performClick();
                } else {
                    if (mZQUserInfo.getIdentitySmallTypes() != null) {
                        int smallType = mZQUserInfo.getIdentitySmallTypes().getValue();
                        if (smallType == TYPE_SMALL_FDDBR) {
                            findViewById(R.id.rg_zqr_czr_type_1).performClick();
                        } else if (smallType == TYPE_SMALL_DLR) {
                            findViewById(R.id.rg_zqr_czr_type_2).performClick();
                        } else if (smallType == TYPE_SMALL_BR) {
                            findViewById(R.id.rg_zqr_czr_type_3).performClick();
                        }
                    }
                }


            }

            et_zqr_base_jg_social.setText(mZQUserInfo.getSocialUniformCreditCode());
            et_zqr_base_jg_legalname.setText(mZQUserInfo.getLegalRepresentativeName());
            et_zqr_dlr_name.setText(mZQUserInfo.getAgentName());
            if (!TextUtils.isEmpty(mZQUserInfo.getAgentLicenseNumber())) {
                et_zqr_dlr_sfz_zyz.setText(mZQUserInfo.getAgentLicenseNumber());
            } else {
                et_zqr_dlr_sfz_zyz.setText(mZQUserInfo.getCreditorsIDCardNumber());
            }
            et_zqr_fr_bank.setText(mZQUserInfo.getBank());
            et_zqr_fr_bankBranch.setText(mZQUserInfo.getBankBranch());
            et_zqr_fr_bankAccountName.setText(mZQUserInfo.getBankAccountName());
            et_zqr_fr_bankAccount.setText(mZQUserInfo.getBankAccount());


            JSONArray provideCardJson = new JSONArray();//身份证附件
            JSONArray providePowerAttorneyJson = new JSONArray();//授权委托书附件
            JSONArray creditorsProvideCardJson = new JSONArray();


            // 机构-法人组合
            if (identityBigTypes == TYPE_BIG_JG && identitySmallTypes == TYPE_SMALL_FDDBR) {
                et_zqr_fr_cardnum.setText(mZQUserInfo.getCardNumber());
                et_zqr_fr_email.setText(mZQUserInfo.getEmail());
                et_zqr_fr_mobile_other.setText(mZQUserInfo.getOtherContact());


                JSONArray provideBusinessLicenseJson = new JSONArray();//营业执照附件
                JSONArray provideLegalRepresentativeJson = new JSONArray();//法定代表人身份证明附件

                if (mZQUserInfo.getProvideBusinessLicense() != null) {
                    provideBusinessLicense = mZQUserInfo.getProvideBusinessLicense().getValue();
                    if (provideBusinessLicense == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_yyzz_type_1).performClick();

                        // TODO 带入附件
//                    for (UploadImage img : mZQUserInfo.getProvideBusinessLicense()) {
//                        JSONObject obj = new JSONObject();
//                        try {
//                            obj.putOpt("attachmentName", img.getFilename());
//                            obj.putOpt("attachmentDownloadAddress", img.getFilepath());
//                            obj.putOpt("attachmentSize", img.getFilesize());
//                            provideBusinessLicenseJson.put(obj);
//                        } catch (JSONException e) {
//                            e.printStackTrace();
//                        }
//                    }

                    } else {
                        findViewById(R.id.rg_zqr_yyzz_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_yyzz_type_2).performClick();
                }

                if (mZQUserInfo.getProvideLegalRepresentative() != null) {
                    provideLegalRepresentative = mZQUserInfo.getProvideLegalRepresentative().getValue();
                    if (provideLegalRepresentative == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_frsfzm_type_1).performClick();
                        if (mZQUserInfo.getProvideLegalRepresentativeAttas() != null) {
                            for (TaskAtta atta : mZQUserInfo.getProvideLegalRepresentativeAttas()) {
                                mImgList_frsfzm.add(atta2img(atta));
                            }
                        }
                    } else {
                        findViewById(R.id.rg_zqr_frsfzm_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_frsfzm_type_2).performClick();
                }

                if (mZQUserInfo.getProvideCard() != null) {
                    int provideCard = mZQUserInfo.getProvideCard().getValue();
                    if (provideCard == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_frsfz_type_1).performClick();
                        if (mZQUserInfo.getProvideCardAttas() != null) {
                            for (TaskAtta atta : mZQUserInfo.getProvideCardAttas()) {
                                mImgList_frsfz.add(atta2img(atta));
                            }
                        }
                    } else {
                        findViewById(R.id.rg_zqr_frsfz_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_frsfz_type_2).performClick();
                }


            } else if (identityBigTypes == TYPE_BIG_ZRR && identitySmallTypes == TYPE_SMALL_BR) { // 自然人-本人组合
                et_zqr_zrr_br_card.setText(mZQUserInfo.getCardNumber());
                et_zqr_zrr_br_email.setText(mZQUserInfo.getEmail());
                et_zqr_zrr_br_mobile_other.setText(mZQUserInfo.getOtherContact());

                if (mZQUserInfo.getProvideCard() != null) {
                    int provideCard = mZQUserInfo.getProvideCard().getValue();
                    if (provideCard == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_zrr_br_sfz_type_1).performClick();
                        if (mZQUserInfo.getProvideCardAttas() != null) {
                            for (TaskAtta atta : mZQUserInfo.getProvideCardAttas()) {
                                mImgList_zrr_br_sfz.add(atta2img(atta));
                            }
                        }
                    } else {
                        findViewById(R.id.rg_zqr_zrr_br_sfz_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_zrr_br_sfz_type_2).performClick();
                }
            } else if (identitySmallTypes == TYPE_SMALL_DLR) { //  X-代理人组合
                et_zqr_dlr_email.setText(mZQUserInfo.getEmail());
                et_zqr_dlr_mobile_other.setText(mZQUserInfo.getOtherContact());


                if (mZQUserInfo.getCreditorsProvideCard() != null) {
                    creditorsProvideCard = mZQUserInfo.getCreditorsProvideCard().getValue();
                    if (creditorsProvideCard == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_dlr_sfz_zyz_type_1).performClick();
                        if (mZQUserInfo.getCreditorsProvideCardAttas() != null) {
                            for (TaskAtta atta : mZQUserInfo.getCreditorsProvideCardAttas()) {
                                mImgList_dlr_sfz_zyz.add(atta2img(atta));
                            }
                        }
                    } else {
                        findViewById(R.id.rg_zqr_dlr_sfz_zyz_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_dlr_sfz_zyz_type_2).performClick();
                }
                if (mZQUserInfo.getProvidePowerAttorney() != null) {
                    providePowerAttorney = mZQUserInfo.getProvidePowerAttorney().getValue();
                    if (providePowerAttorney == TYPE_UPLOAD) {
                        findViewById(R.id.rg_zqr_dlr_sqwt_type_1).performClick();
                        // TODO 带入附件
                        if (mZQUserInfo.getProvidePowerAttorneyAttas() != null) {
                            for (TaskAtta atta : mZQUserInfo.getProvidePowerAttorneyAttas()) {
                                mImgList_dlr_sqwt.add(atta2img(atta));
                            }
                        }
                    } else {
                        findViewById(R.id.rg_zqr_dlr_sqwt_type_2).performClick();
                    }
                } else {
                    findViewById(R.id.rg_zqr_dlr_sqwt_type_2).performClick();
                }
            }
        }

        et_zqr_name.setEnabled(false);
        et_zqr_base_jg_social.setEnabled(false);
        et_zqr_base_jg_legalname.setEnabled(false);
        et_zqr_fr_mobile.setEnabled(false);
        et_zqr_fr_mobile_other.setEnabled(false);
        et_zqr_fr_email.setEnabled(false);
        et_zqr_fr_cardnum.setEnabled(false);
        zqr_change.setEnabled(false);
        et_zqr_fr_bank.setEnabled(false);
        et_zqr_fr_bankBranch.setEnabled(false);

        et_zqr_fr_bankAccountName.setEnabled(false);
        et_zqr_fr_bankAccount.setEnabled(false);
        et_zqr_dlr_name.setEnabled(false);
        et_zqr_dlr_mobile.setEnabled(false);
        et_zqr_dlr_mobile_other.setEnabled(false);
        et_zqr_dlr_email.setEnabled(false);
        et_zqr_dlr_sfz_zyz.setEnabled(false);

        et_zqr_zrr_br_mobile.setEnabled(false);
        et_zqr_zrr_br_mobile_other.setEnabled(false);
        et_zqr_zrr_br_email.setEnabled(false);
        et_zqr_zrr_br_card.setEnabled(false);
        zrr_zqrheadinfo_zrr_zqr_info_et_zqr_zrr_br_card.setEnabled(false);


        btn_commit = findViewById(R.id.btn_commit);
        if (mType == 0) {
            btn_commit.setVisibility(View.VISIBLE);
        } else {
            btn_commit.setVisibility(View.GONE);
        }

        btn_commit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dialog = new ApplyBaseReplyDialog(ApplyChangeZQUserBaseInfoActivity.this, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (v.getId() == R.id.btn_save) {
                            String msg = dialog.text_reason.getText().toString().trim();
                            String status = "1";
                            if (dialog.cb_nopass.isChecked()) {
                                status = "2";
                            }
                            String notifyTypes = "";
                            if (dialog.send_msg.isChecked() && dialog.send_phone.isChecked()) {
                                notifyTypes = "0,1";
                            } else if (dialog.send_msg.isChecked()) {
                                notifyTypes = "0";
                            } else {
                                notifyTypes = "1";
                            }


//                    addZQUser(name,phone);
                            applyPerson(status, msg, notifyTypes);
                            dialog.dismiss();
                        }
                        if (v.getId() == R.id.btn_chancel) {
                            dialog.dismiss();
                        }

                    }
                });
                dialog.show();
            }
        });

    }

    private UploadImage atta2img(TaskAtta atta) {
        UploadImage image = new UploadImage();
        image.setFilename(atta.getAttachmentName());
        image.setFilepath(atta.getAttachmentDownloadAddress());
        image.setFilesize(atta.getAttachmentSize());
        image.setLoadUrl(atta.getAttachmentPreviewAddress());
        return image;
    }

    private void showStatus() {
        area_zqr_type_small.setVisibility(View.VISIBLE);
        include_zqr_base_group.setVisibility(View.GONE);
        include_zqr_legal_person.setVisibility(View.GONE);
        include_zqr_dlr.setVisibility(View.GONE);
        include_zqr_zrr_br.setVisibility(View.GONE);

        zrr_zqrheadinfo.setVisibility(View.GONE);
        if (mType == 0) {
            findViewById(R.id.zqr_legal_ll_bank).setVisibility(View.VISIBLE);
            findViewById(R.id.zqr_ll_bank).setVisibility(View.VISIBLE);
        } else {
            findViewById(R.id.zqr_legal_ll_bank).setVisibility(View.GONE);
            findViewById(R.id.zqr_ll_bank).setVisibility(View.GONE);
        }
        if (identityBigTypes == TYPE_BIG_JG) {
            include_zqr_base_group.setVisibility(View.VISIBLE);
            findViewById(R.id.rg_zqr_czr_type_3).setVisibility(View.GONE);
            et_zqr_name.setHint("请填写公司或机构全称");
            if (identitySmallTypes == TYPE_SMALL_FDDBR) {


                include_zqr_legal_person.setVisibility(View.VISIBLE);
                if (mType == 1) {
                    if (BankruptcyApp.loginInfo != null && BankruptcyApp.loginInfo.getLoginname() != null) {
                        et_zqr_fr_mobile.setText(BankruptcyApp.loginInfo.getLoginname());
                    }
                    et_zqr_fr_mobile.setEnabled(false);
                }
            } else if (identitySmallTypes == TYPE_SMALL_DLR) {
//                ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(mZQUserInfo.getContact());
                if (mType == 1) {
                    if (BankruptcyApp.loginInfo != null && BankruptcyApp.loginInfo.getLoginname() != null) {
                        ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(BankruptcyApp.loginInfo.getLoginname());
                    }
                    ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setEnabled(false);
                }
                include_zqr_dlr.setVisibility(View.VISIBLE);

            }
        }

        if (identityBigTypes == TYPE_BIG_ZRR) {
            et_zqr_name.setHint("请填写对破产企业有债权的个人姓名");
            if (identitySmallTypes == TYPE_SMALL_BR) {
                include_zqr_zrr_br.setVisibility(View.VISIBLE);

//                ((TextView) findViewById(R.id.et_zqr_zrr_br_mobile)).setText(mZQUserInfo.getContact());
                if (mType == 1) {
                    if (BankruptcyApp.loginInfo != null && BankruptcyApp.loginInfo.getLoginname() != null) {
                        ((TextView) findViewById(R.id.et_zqr_zrr_br_mobile)).setText(BankruptcyApp.loginInfo.getLoginname());
                    }
                    ((TextView) findViewById(R.id.et_zqr_zrr_br_mobile)).setEnabled(false);
                }
            } else if (identitySmallTypes == TYPE_SMALL_DLR) {
                zrr_zqrheadinfo.setVisibility(View.VISIBLE);
                include_zqr_dlr.setVisibility(View.VISIBLE);
//                ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(mZQUserInfo.getContact());
                if (mType == 1) {
                    if (BankruptcyApp.loginInfo != null && BankruptcyApp.loginInfo.getLoginname() != null) {
                        ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(BankruptcyApp.loginInfo.getLoginname());
                    }
                    ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setEnabled(false);
                }
            }
        }

        if (identityBigTypes == TYPE_BIG_SW) {
            et_zqr_name.setHint("请填写对破产企业有债权的公司或其他机构的全称");
            area_zqr_type_small.setVisibility(View.GONE);
//            ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(mZQUserInfo.getContact());
            include_zqr_dlr.setVisibility(View.VISIBLE);
            if (mType == 1) {
                if (BankruptcyApp.loginInfo != null && BankruptcyApp.loginInfo.getLoginname() != null) {
                    ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setText(BankruptcyApp.loginInfo.getLoginname());
                }
                ((TextView) findViewById(R.id.et_zqr_dlr_mobile)).setEnabled(false);
            }
        }

    }

    @Override
    public void onBackPressed() {
//        super.onBackPressed();
        findViewById(R.id.titlebar_back).performClick();
    }


    @Override
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.tv_zqr_address:
                intent = new Intent(this, CreateAddrActivity.class);
                intent.putExtra(CreateAddrActivity.KEY_FROM, CreateAddrActivity.FROM_FLOW);
                if (mAddrInfo != null) {
                    intent.putExtra(CreateAddrActivity.KEY_BEAN, mAddrInfo);
                }
                startActivityForResult(intent, REQUEST_CODE_ADDRESS);
                break;
            case R.id.titlebar_menu_text:
                opType = 0;
                saveData();
                break;
            case R.id.titlebar_menu_text_zancun:
                opType = 1;
                saveData();
                break;
            case R.id.titlebar_back:
                mPromptDialog = new CommonPromptDialog(this, CommonPromptDialog.TYPE_TIPS);
                mPromptDialog.setTitle("暂存编辑？");
                mPromptDialog.setPositiveClickListener("是", view12 -> {
                    opType = 1;
                    mPromptDialog.dismiss();
//                    finish();
                    saveData();
                });
                mPromptDialog.setNegativeClickListener("否", view1 -> {
                    mPromptDialog.dismiss();
                    finish();
                });
                mPromptDialog.show();
//                    QQLogin();
                break;
            default:
                break;
        }
    }

    public void saveData() {

    }

    /**
     * 保存信息
     */
    public void applyPerson(String status, String msg, String notifyTypes) {
        if (BankruptcyApp.tokeninfo == null || BankruptcyApp.tokeninfo.getToken() == null) {
            return;
        }

        OkHttpClient okHttpClient = new OkHttpClient();
//        HashMap<String, String> params = new HashMap<String, String>();
        Random random = new Random();
        String rom = random.nextLong() + "";
        String timestamp = System.currentTimeMillis() + "";
        String userToken = SPUtils.getInstance(Consts.SPNAME).getString("userToken", "");
        String userId = SPUtils.getInstance(Consts.SPNAME).getString("userId", "");

//        String no = zqUserDetailInfo.get(0).getId();
        RequestBody requestBody = new FormBody.Builder()
                .add("appid", "1000000001")
                .add("nonce", rom)
                .add("timestamp", timestamp)
                .add("token", BankruptcyApp.tokeninfo.getToken())
                .add("userToken", userToken)
//                .add("creditorId", creditorId)
                .add("auditState", status)
                .add("auditDesc", msg)
                .add("noticeTypes", notifyTypes)
                .add("projectId", mZQUserInfo.getBankruptcyProjectId())
                .add("changeId", mZQUserInfo.getId())
                .add("auditType", "3")
                .build();

        String url = Consts.WEBURL_RIGHTSAUDIT;
        Request request = new Request.Builder()
                .url(url)
                .post(requestBody)
                .build();

        okHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
//                shapeLoadingDialog.dismiss();
//                Log.d(TAG, "onFailure: " + e.getMessage());
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        //更新UI
                        Toast.makeText(ApplyChangeZQUserBaseInfoActivity.this, "保存失败", Toast.LENGTH_SHORT).show();

                    }

                });
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
//                Log.d(TAG, response.protocol() + " " +response.code() + " " + response.message());
                Headers headers = response.headers();
//

                String str = response.body().string();
                try {
                    final JSONObject object = new JSONObject(str);
                    if (object.optInt("code") == 0) {
                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                //更新UI

                                ToastUtil.getInstance(ApplyChangeZQUserBaseInfoActivity.this).showShortToast("审核成功");
                                finish();
//                                Toast.makeText(ApplyChangerZQUserNameActivity.this, "替吉奥成功", Toast.LENGTH_SHORT).show();

                            }

                        });
//                        finish();

                    } else {
                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                //更新UI
                                Toast.makeText(ApplyChangeZQUserBaseInfoActivity.this, "保存失败" + object.optString("msg"), Toast.LENGTH_SHORT).show();

                            }

                        });

                    }
                    str = "";
                } catch (Exception ex) {
                    ex.printStackTrace();
                    runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            //更新UI
                            Toast.makeText(ApplyChangeZQUserBaseInfoActivity.this, "保存失败", Toast.LENGTH_SHORT).show();

                        }

                    });
                }
            }
        });
    }
}

